package com.wander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Wander.Zeng
 * @create 2018-02-06 11:18
 * @desc Launcher4provider
 */
public class Launcher4provider {

    private static Logger logger = LoggerFactory.getLogger(Launcher4provider.class);

    public static void main(String[] args) throws Exception {
        /*ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("dubbo-provider.xml");
        System.out.println(context.getDisplayName() + ": here");
        context.start();
        System.out.println("服务已经启动...");
        System.in.read();*/

        try {
            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("dubbo-provider.xml");
            context.start();
            System.out.println("服务已经启动...");
        } catch (Exception e) {
            logger.error("启动 error : " + e);
        }
        synchronized (Launcher4provider.class) {
            while (true) {
                try {
                    Launcher4provider.class.wait();
                    System.out.println("服务已经启动 synchronized...");
                } catch (Exception e) {
                    logger.error("synchronized error : " + e);
                }
            }
        }

        // Main.main(args);
    }

}
